'use strict';

module.exports = app => {

    const { STRING, INTEGER } = app.Sequelize;

    const Role = app.model.define('role',
        {
            id: { type: INTEGER, primaryKey: true, autoIncrement: true },
            name: STRING(255)
        },
        {
            freezeTableName: true, // Model 对应的表名将与model名相同
            timestamps: false
        }
    )
    // Role.associate = function() {
    //     app.model.Role.hasOne(app.model.User, {foreignKey:'roleId', targetKey: 'id'});
    // }
    return Role
};